
#import "PywLog.h"
//#import "PywAppInfo.h"

@implementation PywLog

+ (void)writeLog:(PywLogLevel)level withFunction:(const char *)func lineNumber:(int)lineNumber format:(NSString *)format {
#ifndef DEBUG
    return;
#endif
//    if (level > [PywAppInfo sharedObject].logLevel) {
//        return;
//    }
    
    if (format == nil || ![format isKindOfClass:[NSString class]]) {
        format = @"";
    }
    
    NSString *strFormat = [NSString stringWithFormat:@"%s %@%i %@%@", func, @"Line: ", lineNumber, @" - ", format];
    
    NSString *strErrorLevel = [[NSString alloc] init];
    switch (level) {
        case PYWLOG_ERR:
            strErrorLevel = @"ERROR";
            break;
        case PYWLOG_WARN:
            strErrorLevel = @"WARN";
            break;
        case PYWLOG_NOTICE:
            strErrorLevel = @"NOTICE";
            break;
        case PYWLOG_DEBUG:
            strErrorLevel = @"DEBUG";
            break;
        default:
            break;
    }
    PLog(@"%@ %@.", strErrorLevel, strFormat);
    
}

@end
